﻿using System.Collections.ObjectModel;
using Prompts.ReportCatalog.Model;

namespace Test.Prompts.Infrastructure.Builders
{
    public class ReportCatalogInfoBuilder
    {
        private ObservableCollection<CatalogItemInfo> _catalogItems = new ObservableCollection<CatalogItemInfo>();
        private bool _errorOccured;
        private string _errorMessage = string.Empty;

        public ReportCatalogInfoBuilder WithCatalogItems(ObservableCollection<CatalogItemInfo> itemInfos)
        {
            _catalogItems = itemInfos;
            return this;
        }

        public ReportCatalogInfoBuilder WithErrorOccured(bool flag)
        {
            _errorOccured = flag;
            return this;
        }

        public ReportCatalogInfoBuilder WithErrorMessage(string errorMessage)
        {
            _errorMessage = errorMessage;
            return this;
        }

        public ReportCatalogInfo Build()
        {
            return new ReportCatalogInfo
                       {CatalogItems = _catalogItems, ErrorOccured = _errorOccured, ErrorMessage = _errorMessage};
        }
    }
}